<?php 
require_once ("core/Database.class.php");
require_once ("core/Activity.class.php");

function ListActivity() {
    $db = new DataBase();
    $link = $db->connect();
    if ($result = $db->query("call ActivityList()")) {
        /* Fetch the results of the stored proceure */
         while ($obj = $result->fetch_assoc()) {
            $activity = new Activity($obj['id'], $obj['name']);
            $allact[] = $activity;
        }
        
    }
    /* Destroy the result set and free the memory used for it */
    mysqli_free_result($result);
    $db->close();
    return $allact;
}


function CreateActivity($activity){
  $db = new DataBase();
  $db->connect();
  $call = "call ActivityCreate('".$activity->get_name()."')";
  $db->query($call); 
  $db->close();
}

?>
